/**
 * Author:runlin。tang.
 * Creation Time: 2016/6/29
 * Description: 充电宝wifi网络列表接口
 */

define(['jquery','../../common/ajax/ajax'],
    function($,ajax) {
        function example(){
            ajax({
                url:interfaces.getClentRtRecourse.url,
                dataType:interfaces.getClentRtRecourse.dataType,
                type:interfaces.getClentRtRecourse.type,
                data:{},
                cache:{
                    use:false,
                    name:'',
                    time:2
                },
                isOk:function(data){
                    var datas = '';
                    if(useNetData){
                        datas = data;
                    }else{
                        datas = data.getClentRtRecourse;
                    }
                    var nuller = 0;
                    if(datas.data.apk_version == 'null'){
                        $(".apk_version").html('<i>获取门店App</i><span>未知<img  src="images/router/ic_state_error.png" height="26" width="37"></span>');
                        nuller = nuller+1;
                    }else{
                        $(".apk_version").html('<i>获取门店App</i><span>'+datas.data.apk_version+'<img  src="images/router/ic_state_correct.png"></span>');
                    }
                    if(datas.data.cgi_version == 'null'){
                        $(".cgi_version").html('<i>获取门店CGI</i><span>未知<img  src="images/router/ic_state_error.png" height="26" width="37"></span>');
                        nuller = nuller+1;
                    }else{
                        $(".cgi_version").html('<i>获取门店CGI</i><span>'+datas.data.cgi_version+'<img  src="images/router/ic_state_correct.png"></span>');
                    }
                    if(datas.data.welcome_version == 'null'){
                        $(".welcome_version").html('<i>获取门店欢迎页</i><span>未知<img  src="images/router/ic_state_error.png" height="26" width="37"></span>');
                        nuller = nuller+1;
                    }else{
                        $(".welcome_version").html('<i>获取门店欢迎页</i><span>'+datas.data.welcome_version+'<img  src="images/router/ic_state_correct.png"></span>');
                    }
                    if(datas.data.shop_info == 'null'){
                        $(".shop_info").html('<i>获取门店信息</i><span>未知<img  src="images/router/ic_state_error.png" height="26" width="37"></span>');
                        nuller = nuller+1;
                    }else{
                        $(".shop_info").html('<i>获取门店信息</i><span>'+datas.data.shop_info+'<img  src="images/router/ic_state_correct.png"></span>');
                    }
                    var text = '';

                    if(nuller>0){
                        $(".bind-bottom").html('').html('<div class="ly-tip erro-tip"><i></i><span>初始化完成，请检查网络！</span><p>如多次失败请拨打<a href="tel:4008077067" style="color:#666"> 4008 077 067</a></p></div><div class="com_btn"><a href="javascript:;" class="inits">初始化</a></div>');
                    }else{
                        $(".bind-bottom").html('').html('<div class="ly-tip ok-tip"><i></i><span>初始化完成，可以正常使用了！</span></div><div class="com_btn"><a href="javascript:;" class="wancheng">完成</a></div>');
                    }
                    $('.wancheng').click(function(){
                        location.href="#admin";
                    });
                    $(".webApp-content").on('click','.inits',function(){
                        example();
                    });
                }
            });
        }
        return example;
});